import request from "@/utils/request";
/**
 * 获取部门列表
 * @returns Promise
 */

export const getDeptListAPI = () => {
  return request({
    method: "get",
    url: "/company/department",
  });
};
/**
 * 删除部门
 * @param {Sting} deptId
 * @returns
 */
export const delDeptAPI = (deptId) => {
  return request({
    method: "delete",
    url: `/company/department/${deptId}`,
  });
};

/**
 * 获取负责人列表
 * @returns Promise
 */
export const getManagerListAPI = () => {
  return request({
    method: "get",
    url: "/sys/user/simple",
  });
};

/**
 * 新增部门
 * @param {Object} deptForm
 * @returns
 */
export const addDeptAPI = (deptForm) => {
  return request({
    method: "post",
    url: "/company/department",
    data: deptForm,
  });
};

/**
 * 获取部门详情
 * @param {String} deptId
 * @returns Promise
 */
export const getDeptDetailAPI = (deptId) => {
  return request({
    method: "get",
    url: `/company/department/${deptId}`,
  });
};

/**
 * 编辑部门
 * @param {Object} deptForm
 * @returns
 */
export const editDeptAPI = (deptForm) => {
  return request({
    method: "put",
    url: `/company/department/${deptForm.id}`,
  });
};
